
function inputJudgment(index) {
    var divid = '', inputid = '';
    switch(index) {
        case 'A': divid = 'field9526'; inputid = 'field9527'; break;
        case 'B': divid = 'field9531'; inputid = 'field9532'; break;
        case 'C': divid = 'field9536'; inputid = 'field9537'; break;
    }
    var divobj = document.getElementById(divid);
    var inputobj = document.getElementById(inputid);
    if (divid == '' || !divobj) {
        alert('参数错误！');
        return;
    }
    if (inputobj.value == '') { alert('请输入意见!'); return; }

    Ext.Ajax.request({
      method:'post',
      url:'${ctx}/wf!saveTaskOpinion.action',
      params:{
        'instance.taskInstDbid': window.parent.WF_CONFIG.taskInstDbid,
        'instance.handleComments': inputobj.value
      },
      success:function(){
      changeOpinion(inputobj.value, divobj);
        inputobj.value = '';
      },
      scope:this
    });
}

function changeOpinion(opinion, divobj) {
  var userOpinion = document.getElementById('userOpinion');
  if (userOpinion) {
    userOpinion.innerHTML = opinion + '<br>&nbsp;&nbsp;&nbsp;&nbsp;'+currentUser+'&nbsp;&nbsp;' + new Date().format('yyyy-MM-dd hh:mm:ss');
  } else {
    divobj.style.color = '#009966';
    divobj.innerHTML = opinion + '<br>&nbsp;&nbsp;&nbsp;&nbsp;'+currentUser+'&nbsp;&nbsp;' + new Date().format('yyyy-MM-dd hh:mm:ss');
  }
}


function writeJudgment(index) {
    var divid = '';
    switch(index) {
        case 'A': divid = 'field9526'; break;
        case 'B': divid = 'field9531'; break;
        case 'C': divid = 'field9536'; break;
    }
    var divobj = document.getElementById(divid);
    if (divid == '' || !divobj) {
        alert('参数错误！');
        return;
    }
   // var toolbarObj = window.parent.WF_TOOLBAR;
   var tiDbId = window.parent.WF_CONFIG.taskInstDbid
    

    
    var win = new Ext.ux.wf.WfOpinionWin({
        taskInstDbid: tiDbId        //Ext.getCmp('WF_TOOLBAR').taskInstDbid
    });
    win.show();
    win.on('complete', function (opinion) {
        divobj.innerHTML = opinion + '<br>&nbsp;&nbsp;&nbsp;&nbsp;'+currentUser+'&nbsp;&nbsp;' + new Date().format('yyyy-MM-dd hh:mm:ss');
    });
}

function judgeContent(objId){
	var content = document.getElementById(objId).value;
	if(content == "" || content.trim().length <=0)
		return false;
	else
		return true;
}

